<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
    function f(arr) {
        //计算出 x y轴的长度
        let y_length = arr.length;
        let x_length = arr[0].length;
        let tmp = Array();
        //先生成一个临时的多维数组
        for (let i = 0; i < x_length; i++) {
            tmp[i] = Array();
            for (let j = 0; j < y_length; j++) {
                tmp[i][j] = 1;
            }
        }
        //遍历输入的数组
        for (let i in arr) {
            for (let j in arr[i]) {
                tmp[j][Math.abs(i-(y_length-1))] = arr[i][j]
            }
        }
        //规律 0,0-->0,2| 1,0-->0,1|2,2|2,0
        //本来的y变成x,x-2绝对值变成y
        return tmp
    }

    let origin = [
        [ 5, 1, 9,11],
        [ 2, 4, 8,10],
        [13, 3, 6, 7],

    ];

    let res = f(origin)


</script>

</body>
</html>